const hanshu = async (config) => {
  let chain = [
    {
      fulfilled: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(config + 1)
        })
      },
      rejected: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(null)
        })
      },
    },
    {
      fulfilled: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(config + 1)
        })
      },
      rejected: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(null)
        })
      },
    },
    {
      fulfilled: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(config + 1)
        })
      },
      rejected: (config) => {
        return new Promise((resolve, reject) => {
          return resolve(null)
        })
      },
    },
  ]
  let promise = Promise.resolve(config)
  while (chain.length) {
    const yuansu = chain[0]
    chain = chain.slice(1)
    const jieguo = await promise
    if(jieguo){
      promise = yuansu.fulfilled(jieguo)
    }else{
      promise = yuansu.rejected(jieguo)
      break
    }
  }
  return promise
}

hanshu(666).then(res=>{
  console.log(res)
})

